<%-- 
    Document   : EndofDayReport
    Created on : Sep 11, 2011, 7:53:18 PM
    Author     : Mikeno
--%>
<%@page import="java.util.*,hyper.market.beans.*,java.io.*"%>
<%@page contentType="text/html"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="initiallist" class="java.util.ArrayList" scope="session"/>
<jsp:useBean id="updatedlist" class="java.util.ArrayList" scope="session"/>
<html>
    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>End Of day Report</title>
        <link rel="stylesheet" href="desk.css" type="text/css" />
        <link rel="stylesheet" href="style/960.css" type="text/css" />
        <link rel="stylesheet" href="style/960_12_col.css" type="text/css" />
        <script type = "text/javascript">
            function changeVisibility(tableNum){
                //keeping track!
                var current = document.getElementById("currentpage").value;
                document.getElementById("reportlist"+current).className ="hidden";//change previous to hidden
                document.getElementById("reportlist"+tableNum).className ="visible";// new 1 to visible
                document.getElementById("currentpage").value = tableNum; // update the value of currentpage
                document.getElementById("reportPage"+current).className = "Inactive";
                document.getElementById("reportPage"+tableNum).className = "Active";
                document.getElementById("reportPage"+current).innerHTML = "<a href=\"#\" onclick='changeVisibility("+(current)+");return false;'><span>"+(current)+"</span></a>";
                document.getElementById("reportPage"+tableNum).innerHTML = "<span>"+(tableNum)+"</span>";

            }
        </script>
    </head>
    <body>
        <div class="header group">
            <div class="pagewidth">
                <ul class="headernav">
                    <li><a href="/HyperMarket/ViewStoresServlet"><img class="headerlogo" src="./arts/logo.png" width="106" height="22" alt="Bagcheck Home" border="0" /></a></li>
                    <li class="headerlink "><a p='header' t='home' href="/HyperMarket/ViewStoresServlet">Home</a></li>
                    <li class="headerlink "><a p='header' t='about' href="/HyperMarket/ViewStoresServlet">View All Stores</a></li>
                    <li class="headerlink "><a p='header'  href="/HyperMarket/createStockServlet">Create Stocks</a></li>
                    <li class="headerlink  headerlinkhl"><a p='header' href="#" onclick="return false;">End Of Day</a></li>
                   <li class="headerlink "><a p='header'  href="/HyperMarket/LogoutServlet">Logout</a></li>

                </ul>
            </div>
        </div>

        <div class="pagewidth alignleft group toppadstock topmarginstock">

            <%  String name = "";
                        int pagecounter = 0;
                        for (int i = 0; i < initiallist.size(); i++) {

                            if (!(name.equals(((StockBean) initiallist.get(i)).getStorename()))) {
                                name = ((StockBean) initiallist.get(i)).getStorename();
                                pagecounter++;

                                if (i == 0) {
                                    out.println("<div id=\"reportlist" + (pagecounter) + "\" name=\"reportlist" + (pagecounter) + "\">");
                                } else {
                                    out.println("</div></div>");
                                    out.println("<div class=\"hidden\" id=\"reportlist" + (pagecounter) + "\" name=\"reportlist" + (pagecounter) + "\">");
                                }
                                out.println("<div class =\"pagewidth leftmargin heightstock\">");
                                out.println("<ul class=\"homenavlist group botmargin heightstock\">");

                                out.println("<li><label class=\"homenavlistli reportlabel\">" + ((StockBean) initiallist.get(i)).getStorename() + "</label></li>");
                                out.println("</ul></div>");
                                out.println("<div id= \"baglistdiv" + (pagecounter) + "\" style = \"margin-top:50px\">");

                            }
                            out.println("<li class='listitem baglist'>");
                            out.println("<label class=\"imgframe listbagimglink\" p=\"bagslist\" t=\"bagimage\">");
                            out.println("<img width=\"150\" height=\"93\" src=\"./product/" + ((StockBean) initiallist.get(i)).getStockImage() + "\" alt=\"" + ((StockBean) initiallist.get(i)).getStockImage() + "\" class=\"listbagimg\"></label>");
                            out.println("<div class='container_12'>");
                            out.println("<div id=\"baggroup\" class=\"grid_4 group \">");
                            out.println("<a href=\"/#\" onclick='return false;' class=\"listbagitemtitle\" p=\"bagslist\" t=\"bagname\">" + ((StockBean) initiallist.get(i)).getStockname() + "</a>");
                            out.println("<p style=\"min-height: 63px;\" class=\"commenttext\">Quantity : " + ((StockBean) initiallist.get(i)).getQuantity() + " &nbsp  Status : " + ((StockBean) initiallist.get(i)).getStatus() + "<br>Cost Price : $" + ((StockBean) initiallist.get(i)).getCostprice() + " &nbsp  Usual Selling Price : $" + ((StockBean) initiallist.get(i)).getSellingprice() + "<br>Threshold : " + ((StockBean) initiallist.get(i)).getThreshold() + " &nbsp Discount %: " + ((StockBean) initiallist.get(i)).getDiscount() + " <br> Expiry Date : " + ((StockBean) initiallist.get(i)).getExpiryDate() + " <br></p>");
                            out.println("</div><div class=\"grid_4\"><p style=\"min-height: 63px;\" class=\"commenttext changesLabel\"><br> Status : " + ((StockBean) updatedlist.get(i)).getStatus() + "<br>Selling Price : $" + ((StockBean) updatedlist.get(i)).getSellingprice() + "<br>Discount %: " + ((StockBean) updatedlist.get(i)).getDiscount() + " <br></p></div>");
                            out.println("</div>");
                            out.println("</li>");
                        }
                        out.println("</div></div>");
                        out.println("<div id=\"pageCategory\">");
                        out.println("<ul class =\"noStyle PageSelector\">");
                        for (int k = 1; k <= pagecounter; k++) {
                            if (k == 1) {
                                out.println("<li class =\"Active\" id=\"reportPage" + (k) + "\">" + k + "</li>");
                            } else {
                                out.println("<li class =\"Inactive\" id=\"reportPage" + (k) + "\"><a href=\"#\" onclick='changeVisibility(" + (k) + ");return false;'><span>" + (k) + "</span></a></li>");
                            }
                        }
                        out.println("</div>");
            %>


        </div>

        <input type="hidden" id="currentpage" value="1">
    </body>
</html>
